package com.twu.biblioteca;

import java.io.PrintStream;
import java.util.List;

public class BookLister implements LibraryAction {

    private List<LibraryBook> bookList;
    private PrintStream printStream;
    private String ACTION_NAME = "1 - List available books";

    public BookLister(List<LibraryBook> bookList, PrintStream printStream){
        this.bookList = bookList;
        this.printStream = printStream;
    }

    @Override
    public void performAction() {
        for (LibraryBook book : bookList) {
            printStream.println(book.toString());
        }
    }

    @Override
    public String toString() {
        return ACTION_NAME;
    }
}
